var gl_vue_vm_list_inventory_html = $('#vue_vm_list_inventory').html();


var beHospitalId = $.url().param('elderBeHospitalId');
var startTime = $.url().param('startTime');
var endTime = $.url().param('endTime');

$(function() {
	$('#vue_vm_list').hide();
    $('#vue_vm_list_inventory').hide();
});

find_costInventory_by_history();

function openTotalPage_history() {
	var pageParam = {};
	pageParam.type = 'timeInterval';
	pageParam.beHospitalId = beHospitalId;
	pageParam.startTime = startTime;
	pageParam.endTime = endTime;

	if(!pageParam.beHospitalId) {
		alert('请查询并选择一位长者');
		return;
	}
	
	window.open('6-2-10paylist-total.html?pageParam='+encodeURIComponent(JSON.stringify(pageParam)));
}

function find_costInventory_by_history() {
    find_basic_by_json(path+'/elderPayRecord/findByBeHospitalId', {beHospitalId: beHospitalId}, function(response) {

        $('#vue_vm_list_inventory').html(gl_vue_vm_list_inventory_html);
        new Vue({
            el: '#vue_vm_list_inventory',
            data: {
                todos: response.data
            },
            methods: {
                getTitle:function() {
                },
                openTotalPage:function() {
                },
                openPrintPage:function(paperType) {
                },
                getElderPayRecordTotalMoney:function(forms) {
                    var totalMoney = 0;
                    if(forms) {
                        for(var i=0; i<forms.length; i++) {
                        	if(forms[i].payWay==3){//如果是vip卡扣费
								continue;
							}
                            totalMoney += forms[i].payMoney;
                        }
                    }

                    return totalMoney;
                },
                getElderArrearageTotalMoney:function(forms) {
                    var totalMoney = 0;
                    if(forms) {
                        for(var i=0; i<forms.length; i++) {
                            totalMoney += forms[i].arrearageMoney;
                        }
                    }
                    return totalMoney;
                }
            }
        });

        $('#vue_vm_list_inventory').show();
    });
}